Skip to content

Conversation

@AkihiroSuda
Copy link
Member

Improve reproducibility by eliminating protoc-gen-go-grpc version strings

Unblock:

Improve reproducibility by eliminating protoc-gen-go-grpc version strings

Unblock PR 4129

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Oct 7, 2025
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

#
# perl is used because `sed -i` is not portable across BSD (macOS) and GNU.
perl -pi -E 's@(^//.*)protoc[[:blank:]]+v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+@\1protoc version [omitted for reproducibility]@g' "$PB_GO" "$GRPC_PB_GO"
perl -pi -E 's@(^//.*protoc.*)[[:blank:]]+v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+@\1 [version omitted for reproducibility]@g' "$PB_GO" "$GRPC_PB_GO"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm old-fashioned, but I find the \s and \d escapes more readable than the noisy POSIX character classes:

Suggested change
perl -pi -E 's@(^//.*protoc.*)[[:blank:]]+v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+@\1 [version omitted for reproducibility]@g' "$PB_GO" "$GRPC_PB_GO"
perl -pi -E 's@(^//.*protoc\S*)\s+v\d+\.\d+\.\d+@\1 [version omitted for reproducibility]@g' "$PB_GO" "$GRPC_PB_GO"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel single-character escapes are cryptic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you find regular expressions cryptic, you can use the /x modifier to insert whitespace to break up the pattern into groups:

perl -pi -E 's@ (^//.*protoc.*)  [[:blank:]]+  v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ @\1 [version omitted for reproducibility]@gx' "$PB_GO" "$GRPC_PB_GO"

@AkihiroSuda AkihiroSuda merged commit d898a7d into lima-vm:master Oct 8, 2025
171 of 177 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants